import { isObject } from "../share/utils";
import mutableHandel from "./mutableHandle";

export function useReactive(target) {
  return createReactObject(target, mutableHandel);
}

function createReactObject(target, baseHandler) {
  if (!isObject(target)) return target;

  const observer = new Proxy(target, baseHandler);

  return observer;
}
